package cn.sjx.graduate.redisenum;

import lombok.Getter;

import java.util.concurrent.TimeUnit;

/**
 * @Author: bo-feifei
 * @Date 2022/1/11 11:02
 * @Version 1.0
 */
@Getter
public enum RedisEnum {
    USER_TOKEN("userToken:",TimeUnit.MINUTES,30);

    private String prefix;
    private TimeUnit unit;
    private int expireTime;
    RedisEnum(String prefix, TimeUnit unit, int expireTime) {
        this.prefix = prefix;
        this.unit = unit;
        this.expireTime = expireTime;
    }

    public String getPrefix() {
        return prefix;
    }

    public void setPrefix(String prefix) {
        this.prefix = prefix;
    }

    public TimeUnit getUnit() {
        return unit;
    }

    public void setUnit(TimeUnit unit) {
        this.unit = unit;
    }

    public int getExpireTime() {
        return expireTime;
    }

    public void setExpireTime(int expireTime) {
        this.expireTime = expireTime;
    }

    public String getRealKey(String key){
        return this.prefix+key;
    }
}
